<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="../common.jsp" %>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%@ taglib uri="/WEB-INF/tld/orderStatus.tld" prefix="os" %>
<%@ taglib uri="/WEB-INF/tld/fmt.tld" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/tld/core.tld" prefix="c"%>
<%@ taglib uri="/WEB-INF/tld//unicode_zh_code.tld" prefix="uc" %>
<style> 
#gaiqian_form input { width:15em; padding:4px; border:1px solid #CCC; }
#gaiqian_form input:focus { border-color:#426DC9; }
#gaiqian_form .form-error { background:#FFFBFC; border-color:#F00 !important; }
</style>
	<form id="gaiqian_form" action="planeGaiqian_doAdd.shtml" method="post">
	<table border="0" cellpadding="0" cellspacing="0" width="100%" class="mytable">
    <tr><th class="left">平台订单号</th><th>出发日期</th><th>航程信息</th><th>航班号</th><th>舱位</th></tr>
    <tr>
    	<td class="left">${vo.childrenOrder.terraceSn}</td>
    	<td><s:date name="vo.childrenOrder.sdate" format="yyyy年MM月dd日"/></td>
    	<td><uc:code codeType="city" code="${vo.childrenOrder.scityCode}"/>-<uc:code codeType="flight" code="${vo.childrenOrder.scityCode}"/>
    	<b>[<s:date name="vo.childrenOrder.depTime" format="HH:mm"/>]</b><br/>
    	<uc:code codeType="city" code="${vo.childrenOrder.ecityCode}"/>-<uc:code codeType="flight" code="${vo.childrenOrder.ecityCode}"/>
    	<b>[<s:date name="vo.childrenOrder.arrTime" format="HH:mm"/>]</b></td>
    	<td>${vo.childrenOrder.flightNo}</td>
    	<td>${vo.childrenOrder.cabinCode}</td>
    </tr>
 </table>
 <br/>
		<table class="mytable" width="100%" cellpadding="0" cellspacing="0">
			<tr><th colspan="9">乘客信息</th></tr>
			<s:if test="vo.orderPassengers.size()>0">
			<tr style="font-size: 14px; font-weight: bolder">
				<td class="left">&nbsp;</td>
				<td>姓名</td>
				<td>类型</td>
				<td>证件号码</td>
				<td>票号</td>
				<td>状态</td>
			</tr>
			<s:iterator value="vo.orderPassengers" id="passengerInfo">
				<tr>
					<td class="left"><input type="checkbox" name="Icheckbox" onclick="changePerson();"
						value="${passengerInfo.passenger}"></td>
					<td>${passengerInfo.passenger}</td>
					<td>${passengerInfo.psgType==1?"成人":"儿童"}</td>
					<td><s:property value="#passengerInfo.cardNum" /></td>
					<s:if test="vo.childrenOrder.traltype==1">
						<td>${passengerInfo.ticketNo!=null?passengerInfo.ticketNo:'——'}</td>
						<td><os:personState state="${passengerInfo.state}"/></td>
					</s:if>
					<s:else>
						<td>${passengerInfo.secTicketNo!=null?passengerInfo.secTicketNo:'——'}</td>
						<td><os:personState state="${passengerInfo.secState}"/></td>
					</s:else>
				</tr>
			</s:iterator>
			</s:if>
			<s:else>
				<tr><td class="left" colspan="9">没有符合条件的乘客</td></tr>
			</s:else>
		</table>
		<br />
		<TABLE height="auto" width="100%" border=0 class="mytable" cellPadding=0
			cellSpacing=0>
			<TBODY>
				<th colspan="10">航程信息</th>
				<tr>
					<td class="left"><label>时间</label>
					</td>
					<td><input type="text" id="gqTime" class="Wdate" style="width: 120px;" readonly="readonly"  onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',minDate:'%y-%M-%d %H:%m'})"
						name="childrenOrder.gqTime" value="" />
					</td>
					<td class="left"><label>航班号</label>
					</td>
					<td><input type="text" id="gqFlightNo" size="10" name="childrenOrder.gqFlightNo"
						value="${childrenOrder.gqFlightNo}" maxlength="6" />
					</td>
				</tr>
				<tr>
					<td class="left"><label>描述</label>
					</td>
					<td colspan="3" align="center" ><s:textarea cols="80%" rows="5"
							name="childrenOrder.gqRemarks" id="gqRemarks" cssStyle=" overflow: hidden;"></s:textarea>
					</td>
				</tr>
			</TBODY>
		</table>
		<input name="personArray" id="personArray" value="" type="hidden" />
		<input name="cid" id="cid" value="${vo.childrenOrder.id}" type="hidden" />
		
	</form>
<script type="text/dialog">
var api = this,
form=$('#gaiqian_form'),
departTime = $('#gqTime'),
gqFlightNo = $("#gqFlightNo"),
gqTime = $("#gqTime"),
remark=$('#gqRemarks');
api.title('办理改签').button(
{
	name:'确定',
	focus:true,
	callback:function(){
		if($.trim($('#personArray').val())==''){art.dialog.tips('请选择至少一名需要办理的乘客!',2);return false;}
		if($.trim(departTime.val())==''){art.dialog.tips('请选择航程时间!',2);return false;}
		if($.trim(gqFlightNo.val())==''){art.dialog.tips('请填写航班号!',2);return false;}
		if(!regexFlight($.trim(gqFlightNo.val()))){art.dialog.tips('航班号输入格式有误!',2);return false;}
		if($.trim(remark.text())==''){art.dialog.tips('请填写描述信息!',2);return false;}
		var dialog = art.dialog({
			title:'系统提示',
			id:'system_warn'+${vo.childrenOrder.id},
			content:'<font style="font-size:14px;">系统正在处理中……</font>',
			lock:true
		});
		$.ajax({
			cache:false,
			type:'POST',
			url:form.attr('action'),
			data:form.serialize(),
			error:function(request){art.dialog.tips('服务器响应失败',2);return false;},
			success:function(result){
				if(result=='T'){
					closeAllDialog();
					art.dialog({lock: true,
								title : '系统提示',
								content :'改签申请提交成功,等待服务商处理……',time : 2,
								close : function() {location.reload();}
					});
				}else{
					closeAllDialog();
					art.dialog({lock: true,
								title : '系统提示',
								content :result	+ '，2秒后关闭……',time : 2
					});
				}
			}
		});
		return false;
	}
},
{name:'取消'}
);
// 航班验证
regexFlight=function (input){
	return /^[0-9A-Z]{2}\d{3,4}$/.test(input);
};
changePerson = function(){
	var person='';
	$('input[name="Icheckbox"]').each(function(i){
		if($(this).attr('checked')==true){
			person +=$(this).val()+'|';
		}	
	});
	person=person.substring(0,person.length-1);
	$('input[name="personArray"]').val(person);
};
</script>
